package com.kgc.xsProvider.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.xs.remote.SalesOrdersRemote;
import com.kgc.xsProvider.service.SalesOrdersService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.Map;

@Controller
public class SalesOrdersController implements SalesOrdersRemote {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SalesOrdersService salesOrdersService;




    @Override
    public ResponseMsg selectSalesOrdersByPage(Map<String, Object> map) {
        logger.info("SalesOrdersController selectSalesOrdersByPage params {}", map.toString());
        ResponseMsg responseMsg =salesOrdersService.selectSalesOrdersByPage(map);
        logger.debug("SalesOrdersController selectSalesOrdersByPage responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg insertSalesOrders(Map<String, Object> map) {
        logger.info("SalesOrdersController insertSalesOrders params {}", map.toString());
        ResponseMsg responseMsg =salesOrdersService.insertSalesOrders(map);
        logger.debug("SalesOrdersController insertSalesOrders responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg updateSalesOrders(Map<String, Object> map) {
        logger.info("SalesOrdersController updateSalesOrders params {}", map.toString());
        ResponseMsg responseMsg =salesOrdersService.updateSalesOrders(map);
        logger.debug("SalesOrdersController updateSalesOrders responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg deleteSalesOrders(Map<String, Object> map) {
        logger.info("SalesOrdersController deleteSalesOrdersById(int id) params {}", map.toString());
        ResponseMsg responseMsg =salesOrdersService.deleteSalesOrders(map);
        logger.debug("SalesOrdersController deleteSalesOrdersById(int id) responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesOrdersById(int id) {
        logger.info("SalesOrdersController selectSalesOrdersById(int id) params {}", id);
        ResponseMsg responseMsg =salesOrdersService.selectSalesOrdersById(id);
        logger.debug("SalesOrdersController selectSalesOrdersById(int id) responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg checkSalesOrdersById(Map<String,Object> map) {
        logger.info("SalesOrdersController checkSalesOrdersById(int id) params {}", map);
        ResponseMsg responseMsg =salesOrdersService.checkSalesOrdersById(map);
        logger.debug("SalesOrdersController checkSalesOrdersById(int id) responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesOrdersDetailByPage(Map<String, Object> map) {
        logger.info("SalesOrdersController selectSalesOrdersDetailByPage params {}", map.toString());
        ResponseMsg responseMsg = salesOrdersService.selectSalesOrdersDetailByPage(map);
        logger.debug("SalesOrdersController selectSalesOrdersDetailByPage responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesOrdersDetailById(int id) {
        logger.info("SalesOrdersController selectSalesOrdersDetailById(int id) params {}", id);
        ResponseMsg responseMsg = salesOrdersService.selectSalesOrdersDetailById(id);
        logger.debug("SalesOrdersController selectSalesOrdersDetailById responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg deleteSalesOrdersDetail(String xsOrderCode) {
        logger.info("SalesOrdersController deleteSalesOrdersDetail(int id) params {}", xsOrderCode);
        ResponseMsg responseMsg = salesOrdersService.deleteSalesOrdersDetail(xsOrderCode);
        logger.debug("SalesOrdersController deleteSalesOrdersDetail responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesOrdersByCode(String docCode) {
        logger.info("SalesOrdersController selectSalesOrdersByCode(int id) params {}", docCode);
        ResponseMsg responseMsg = salesOrdersService.selectSalesOrdersByCode(docCode);
        logger.debug("SalesOrdersController selectSalesOrdersByCode responseMsg {}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesOrdersDetailByCode(String xsOrderCode) {
        logger.info(" SalesOrdersController selectSalesOrdersDetailByCode params {}", xsOrderCode);
        ResponseMsg responseMsg = salesOrdersService.selectSalesOrdersDetailByCode(xsOrderCode);
        logger.debug("SalesOrdersController selectSalesOrdersDetailByCode responseMsg {}", responseMsg);
        return responseMsg;
    }


}
